@extends('common')
@section('content')

    <form class="form-inline definewidth m20" action="index.html" method="get">
        被投诉人：
        <select id="coach" style="width:150px">
            <option value="all">全部</option>
            @foreach($coa_name as $v)
                @if($id==$v['use_id'])
                    <option value="{{$v['use_id']}}" selected>{{$v['use_name']}}</option>
                @else
                    <option value="{{$v['use_id']}}">{{$v['use_name']}}</option>
                @endif
            @endforeach
        </select>
    </form>
    <div id="tab">
        <table class="table table-bordered table-hover definewidth m10" >
            <thead>
            <tr>
                <th>投诉人</th>
                <th>身份证号</th>
                <th>被投诉人</th>
                <th>被投诉人编号</th>
                <th>投诉事由</th>
            </tr>
            </thead>
            @foreach($com_info['data'] as $v)
            <tr>
                <td>{{$v['s_name']}}</td>
                <td>{{$v['use_card']}}</td>
                <td>{{$v['j_name']}}</td>
                <td>{{$v['use_num']}}</td>
                <td>{{$v['com_case']}}</td>
            </tr>
            @endforeach
        </table>
        <div class="inline pull-right page">
            {{$com_info['total']}} 条记录 {{$com_info['current_page']}}/{{$com_info['last_page']}} 页
            <a href="{{url('/execu/complaints')}}?page=1&&id={{$id}}">第一页</a>
            @if($com_info['current_page']>5)
                <a href='{{url('/execu/complaints')}}?page={{$num['min']-5}}&&id={{$id}}' >上5页</a>
            @endif
            <a href="{{url('/execu/complaints')}}?page={{$com_info['current_page']-1<1?1:$com_info['current_page']-1}}&&id={{$id}}">上一页</a>
            @for($i=$num['min'];$i<=$num['max'];$i++)
                @if($i ==$com_info['current_page'])
                <a href="{{url('/execu/complaints')}}?page={{$i}}&&id={{$id}}" class='current'>{{$i}}</a>
                @else
                <a href="{{url('/execu/complaints')}}?page={{$i}}&&id={{$id}}">{{$i}}</a>
                @endif
            @endfor
            <a href="{{url('/execu/complaints')}}?page={{$com_info['current_page']+1>$com_info['last_page']?$com_info['last_page']:$com_info['current_page']+1}}&&id={{$id}}">下一页</a>
            @if($com_info['last_page']>5&&$com_info['current_page']<=ceil($com_info['last_page']/5-1)*5)
                <a href="{{url('/execu/complaints')}}?page={{$num['max']+1}}&&id={{$id}}" >下5页</a>
            @endif
            <a href="{{url('/execu/complaints')}}?page={{$com_info['last_page']}}&&id={{$id}}" >最后一页</a>
        </div>
    </div>
    <script>
        $("#coach").change(function(){
            var id=$(this).val();
            var url="{{url('execu/complaints')}}";
            $.get(url, {id:id},
                    function(data){
                        //alert(data);
                        $("#tab").html(data);
                    });
        })
    </script>
@stop